from fastapi import APIRouter


def init_router():
    router = APIRouter()
    add_router(router)
    return router


def add_router(router: APIRouter):
    from api.v1.tenantapi.tenant.tenant import router as tenant_router
    from api.v1.tenantapi.tenant.tenant import tenant_base_router
    from api.v1.tenantapi.user.user import router as user_router
    from api.v1.tenantapi.user.user import login_router
    from api.v1.tenantapi.pay_way import router as pay_way_router
    from api.v1.tenantapi.mall.mall import router as mall_router
    from api.v1.tenantapi.mall.spu import router as spu_router
    from api.v1.tenantapi.mall.stock import router as stock_router

    router.include_router(tenant_router, prefix="/v1")
    router.include_router(tenant_base_router, prefix="/v1")
    router.include_router(user_router, prefix="/v1")
    router.include_router(login_router, prefix="/v1")
    router.include_router(pay_way_router, prefix="/v1")
    router.include_router(mall_router, prefix="/v1")

    router.include_router(spu_router, prefix="/v1/mall/{code:str}")
    router.include_router(stock_router, prefix="/v1/mall/{code:str}")